﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using COM.OA.BLL;
using COM.OA.Entity;
using System.Collections.Generic;

public partial class gxxz_delfile : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string str = this.Request["id3"];
        string[] ids = str.Split(',');
        foreach (string s in ids)
        {
            if (s == "")
            {
                break;
            }
            else
            {
                int id = Int32.Parse(s);
                files f = filesBLL.Select(id);
                string  where= "fre_f_id=" + f.f_id;
                IList<filerevert> flist = filerevertBLL.Select(where);
                
                if (flist.Count==0)
                {
                    
                    filesBLL.Delete(id);
                }
                else
                {
                    filerevert ff = flist[0];
                    filerevertBLL.Delete(ff.fre_id);
                    filesBLL.Delete(id);
                }
            }
        }
        this.Response.Write(string.Format(GetRedirect.WINALERT,"删除成功"));
        this.Response.Write(string.Format(GetRedirect.REDIRECT,"lb_adminupload.aspx"));
    }
}
